import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import javax.swing.*;



public class control extends JFrame {

	private JFrame window;
	private String fileStr;
	private static JTextArea area;
	private JScrollPane sp;
	private static JLabel l;
	private static JLabel p;
	ImageIcon icon;
	ImageIcon icon1;
	private JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13, b14;
	
	
	
	
	public void frame() {
		this.setTitle("StarCraft 2 stuff");
		this.setLayout(new GridLayout(2,3));
		this.setSize(550, 800);
		this.setResizable(false);
		this.setBackground( Color.RED);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		b1.setBackground(Color.green);
		b2.setBackground(Color.green);
		b3.setBackground(Color.green);
		b4.setBackground(Color.red);
		b5.setBackground(Color.red);
		b6.setBackground(Color.red);
		b7.setBackground(Color.blue);
		b8.setBackground(Color.blue);
		b9.setBackground(Color.blue);
		b10.setBackground(Color.red);
		b11.setBackground(Color.green);
		b12.setBackground(Color.blue);
		b13.setBackground(Color.green);
		b14.setBackground(Color.blue);
		
	
		 icon = new ImageIcon("sc2funfun1.jpg");
		 icon1 = new ImageIcon("sc2box.jpg");
		l = new JLabel(icon1);
		p = new JLabel(icon);
		this.add(p);
		this.add(l);
		
		
		area = new JTextArea(10, 15);
		area.setLineWrap(true);
		area.setWrapStyleWord(true);
		area.setEditable(false);
		
		sp = new JScrollPane(area);
		this.add(sp);
		this.setVisible(true);
	}

	public control() {
	
		tB();
		frame();
		
		
	}

	public void tB() {
		
		JTabbedPane tp = new JTabbedPane();
		//ZERG
		JPanel zergPanel = new JPanel();
		zergPanel.setLayout(new GridLayout(9,10));
		b1 = new JButton("14/14");
		zergPanel.add(b1);
		b1.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("zerg6.jpg");
				icon1 = new ImageIcon("zerg3.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("1414.txt");
				
			}
			
		});
		
		b11 = new JButton("7 Roach Rush");
		zergPanel.add(b11);
		b11.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("zerg6.jpg");
				icon1 = new ImageIcon("zerg3.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("7roach.txt");
				
			}
			
		});
		
		b13 = new JButton("Destiny's ZvZ Build");
		zergPanel.add(b13);
		b13.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("zerg6.jpg");
				icon1 = new ImageIcon("zerg3.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("Destinyzvz.txt");
				
			}
			
		});
		
		
		b2 = new JButton("stephano's 11 min max roach");
		zergPanel.add(b2);
		b2.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("zerg6.jpg");
				icon1 = new ImageIcon("zerg3.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				
				loadTxtFile("11minR.txt");
			
				
			}
			
		});
		b3 = new JButton("14/16");
		zergPanel.add(b3);
		b3.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				loadTxtFile("1416.txt");
				icon = new ImageIcon("zerg6.jpg");
				icon1 = new ImageIcon("zerg3.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
			}
			
		});
		tp.addTab("Zerg", null, zergPanel, "Does nothing");
		
		
		//TERRAN
		JPanel terranPanel = new JPanel();
		terranPanel.setLayout(new GridLayout(9,10));
		b4 = new JButton("1 Rax Expo");
		terranPanel.add(b4);
		b4.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("terran.jpg");
				icon1 = new ImageIcon("terran1.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("1rE.txt");
			
			}
			
		});
		b10 = new JButton("MKP's M&M&M");
		terranPanel.add(b10);
		b10.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("terran.jpg");
				icon1 = new ImageIcon("terran1.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("MKP.txt");
			
			}
			
		});
		b5 = new JButton("1/1/1");
		terranPanel.add(b5);
		b5.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("terran.jpg");
				icon1 = new ImageIcon("terran1.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("1-1-1.txt");
			
			}
			
		});
		b6 = new JButton("FE: Seige");
		terranPanel.add(b6);
		b6.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("terran.jpg");
				icon1 = new ImageIcon("terran1.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("FEs.txt");
			
			}
			
		});
		tp.addTab("Terran", null, terranPanel, "Does nothing");
		
		
		JPanel protossPanel = new JPanel();
		protossPanel.setLayout(new GridLayout(9,10));
		b14 = new JButton("FFE");
		protossPanel.add(b14);
		b14.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("protoss.jpg");
				icon1 = new ImageIcon("protoss1.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("FFEp.txt");
			
			}
			
		});
		b7 = new JButton("3 gate robo");
		protossPanel.add(b7);
		b7.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("protoss.jpg");
				icon1 = new ImageIcon("protoss1.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("3gaterobo.txt");
			
			}
			
		});
		
		b12 = new JButton("3 gate expo");
		protossPanel.add(b12);
		b12.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("protoss.jpg");
				icon1 = new ImageIcon("protoss1.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("3gateexpo.txt");
			
			}
			
		});
		
		b8 = new JButton("Huk's 20 Food Expo");
		protossPanel.add(b8);
		b8.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("protoss.jpg");
				icon1 = new ImageIcon("protoss1.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("huk20food.txt");
			
			}
			
		});
		
		b9 = new JButton("DT Rush");
		protossPanel.add(b9);
		b9.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				icon = new ImageIcon("protoss.jpg");
				icon1 = new ImageIcon("protoss1.jpg");
				l.setIcon(icon);
				p.setIcon(icon1);
				loadTxtFile("DTrush.txt");
			
			}
			
		});
		tp.addTab("Protoss", null, protossPanel, "Does nothing");
		this.add(tp);

	}

	private void loadTxtFile(String txtFileName) {
		try {
			BufferedReader br = new BufferedReader(new FileReader(
					txtFileName));
			String wholeStr = "";
			String sCurrentLine;

			while ((sCurrentLine = br.readLine()) != null) {
				
				wholeStr += sCurrentLine += "\n";
			}
			
			area.setText(wholeStr);
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
	
	
	
		
	}

